Skip to content

Conversation

@DAChernikov
Copy link
Owner

HW5 has been completed.

Rewrite README with full description of BioSeqTools
Copy link

@SidorinAnton SidorinAnton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Новый код и РИДМИ выглядят хорошо, однако оч жалко, что не поправлены моменты в aminoacids_tools и dna_rna_tools.
Вот отсюда:

Второй момент -- кеш пайчарма и .DS_Store. Этого в репе быть не должно )))
Никита рассказывал про файл .gitignore ну и + нужно хотя бы перед коммитом сделать git status ))

Ну и последнее:

  • файлы в либах не принято называть с заглавных букв (т.е. Modules --> modules)
  • название modules тоже не оч хорошее. Можно было бы назвать в духе bio_tools
  • весь код в 1 коммите -- оч такое себе ))

from typing import Dict


def calculate_percentage(seq: str) -> str:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Честно говоря, из названия не оч понятно, что за процент

for amino_acid, count in amino_acid_counts.items():
percentage = round(((count / total_amino_acids) * 100), 2)
amino_acid_percentages[amino_acid] = percentage
return f'Amino acids percentage of the sequence {seq}: {amino_acid_percentages}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Всё-таки тут лучше возвращать именно словарь (amino_acid_percentages), т.к. он может понадобиться при расчете чего-то другого. Отображение можно сделать в другой функции, которая как раз принимала бы этот словарь

weight = 18.02 # for the H and OH at the termini
for amino_acid in seq:
weight += amino_acid_weights[amino_acid]
return f'Molecular weight of the sequence {seq}: {round(weight, 2)} Da'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Та же история, что тут лучше возвращать число. Для отображения можно завести другую функцию

return f'Molecular weight of the sequence {seq}: {round(weight, 2)} Da'


def calculate_hydrophobicity_eisenberg(sequence):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нет типов :(

return f"Sequence {sequence}: Neutral"


def calculate_pI(sequence):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нет типов :(

motif_idx += 1
else:
break
if motif_idx == len(motif):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А разве тут не всегда True?

Comment on lines +148 to +164
while seq_idx < len(seq):
motif_idx = 0
chars_at_motif_idx = motif[motif_idx]
seq_char = seq[seq_idx]
if seq_char in chars_at_motif_idx:
motif_idx += 1
while motif_idx < len(motif):
chars_at_motif_idx = motif[motif_idx]
seq_char = seq[seq_idx+motif_idx]
if seq_char in chars_at_motif_idx:
motif_idx += 1
else:
break
if motif_idx == len(motif):
cleavage_sites.append(seq_idx + motif_idx)
seq_idx += 1
return cleavage_sites

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В предыдущем ревью этого ДЗ писал, как лучше изменить :(
image

Comment on lines +190 to +194
def is_peptide(seq: str) -> bool:
"Check whether the incoming sequence is an aminoacid"
if set(seq).issubset(all_aminoacids): # if set(seq) <= all_aminoacids
return True
raise ValueError(f'Incoming sequence {seq} is not a peptide')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Из предыдущего ревью:
image

def complement(sequence):
complement_dict = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C', 'a': 't',
't': 'a', 'c': 'g', 'g': 'c'}
complement_sequence = ''.join(complement_dict.get(base, base)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Опять .get

Comment on lines +26 to +32
def reverse_complement(dna_sequence):
# можно также "complement_sequence = complement(dna_sequence)"
complement_dict = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C', 'a': 't',
't': 'a', 'c': 'g', 'g': 'c'}
complement_sequence = ''.join(complement_dict.get(base, base)
for base in dna_sequence)
return complement_sequence[::-1]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Есть же функции для reverse и complement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants